require('./platform/Extensions');
var Contract = require("./Contracts")
var JsonStreamer = (function () {
    function JsonStreamer(ignore) {
        this.ignoreMembers = ignore;
        this.includeNullValues = true;
    }
    JsonStreamer.prototype.serialize = function (value) {
        var _this = this;
        if(this.ignoreMembers) {
            return JSON.stringify(value, function (key, value) {
                return _this.ignoreMembers.contains(key) ? null : value;
            }, false);
        } else {
            return JSON.stringify(value, null, false);
        }
    };
    JsonStreamer.prototype.deserialize = function (value) {
        return JSON.parse(value);
    };
    return JsonStreamer;
})();
exports.JsonStreamer = JsonStreamer;
var ToStringStreamer = (function () {
    function ToStringStreamer() { }
    ToStringStreamer.prototype.serialize = function (value) {
        if(value) {
            return typeof value === 'string' ? value : value.toString();
        } else {
            return null;
        }
    };
    ToStringStreamer.prototype.deserialize = function (value) {
        return value;
    };
    return ToStringStreamer;
})();
exports.ToStringStreamer = ToStringStreamer;
var NumberStreamer = (function () {
    function NumberStreamer() { }
    NumberStreamer.prototype.serialize = function (value) {
        if(value) {
            return value.toString();
        } else {
            return null;
        }
    };
    NumberStreamer.prototype.deserialize = function (value) {
        if(value && value.length) {
            return new Number(value);
        } else {
            return null;
        }
    };
    return NumberStreamer;
})();
exports.NumberStreamer = NumberStreamer;
var BooleanStreamer = (function () {
    function BooleanStreamer() { }
    BooleanStreamer.prototype.serialize = function (value) {
        return value ? 'true' : 'false';
    };
    BooleanStreamer.prototype.deserialize = function (value) {
        return value === 'true' ? true : false;
    };
    return BooleanStreamer;
})();
exports.BooleanStreamer = BooleanStreamer;

